<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2022-10-10
 * Time: 21:12
 */

namespace App\controller\work;
use app\model\OrderAssignment;
use support\Db;
use support\exception\Forbidden;
use support\Request;
use Webman\RedisQueue\Redis;
class Order
{
    public function save(Request $request)
    {
        if(!$request->isPost()){
            throw new Forbidden();
        }
        OrderAssignment::whereNotNull('shop_name')->delete();
        $j=$request->post();
        if(empty($j)){
            return json(['code'=>403,'message'=>'传入空值']);
        }
        $j=(new OrderAssignment())->saveAll($j);
        return json($j);
    }

    public function sendMessage(Request $request)
    {
        Redis::send('app-message', []);
        return json(['code'=>0,'message'=>'推送进行中']);
    }
}